<?php

namespace App\Http\Controllers\web;

use App\Http\Controllers\Controller;
use App\Repository\RepositoryInterface\DistributionInterface;
use Illuminate\Http\Request;
//分销类
class DistributionController extends Controller
{
    //
    protected $dis;

    public function __construct(DistributionInterface $dis){
        $this->dis = $dis;
    }

    /**
     * @param Request $request
     * @return array  修改会员会员
     */
    public function memberSet(Request $request)
    {
        try {
            $data = $request->all();
            $id = $request->get('id',1);
            $data = $this->dis->memberSet($id,$data);
            return ['code'=>20000,'msg'=>'success','data'=>[]];
        }catch (\Exception $exception){
            return ['code'=>5000,'msg'=>$exception,'data'=>[]];
        }
    }

    /**
     * @param Request $request
     * @return array 获取设置
     */
    public function getSet(Request $request)
    {
        try {
            $id = $request->post('id',1);
            $data = $this->dis->getSet($id);
            return ['code'=>20000,'msg'=>'success','data'=>$data];
        }catch (\Exception $exception){
            return ['code'=>5000,'msg'=>$exception,'data'=>[]];
        }
    }
}
